#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys

from cli import Tool
from base import *


@Tool.add("编译主干")
def _client_update(free_type):
    client_update("up")


@Tool.add("编译分支")
def _client_update(free_type):
    client_update("up Week")


@Tool.add("更新服务器")
def _server_update(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_update(cmd_id)


@Tool.add("重启服务器")
def _server_restart(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_restart(cmd_id)


@Tool.add("清档")
def _server_drop(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_drop(cmd_id)


@Tool.add("转分支")
def _server_switch(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_switch(cmd_id)


@Tool.add("查看进程")
def _server_show(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_show(cmd_id)


@Tool.add("开服")
def _server_run(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_run(cmd_id)


@Tool.add("关服")
def _server_stop(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_stop(cmd_id)


@Tool.add("重置配置表")
def _server_revert(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_revert(cmd_id)


@Tool.add("查看配置表")
def _server_revert(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_autocode_view(cmd_id)


@Tool.add("CleanUp")
def _server_revert(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_clean_up(cmd_id)


@Tool.add("宕机")
def _server_kill(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_kill(cmd_id)


@Tool.add("切换赛季")
def _server_change_season(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_change_season(cmd_id)


@Tool.add("增加战斗log")
def _server_add_log(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_add_log(cmd_id)


@Tool.add("登录账号限制")
def _server_add_log(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_account_ban_login(cmd_id)


@Tool.add("回退客户端配置表")
def _client_revert(free_type):
    client_revert()


@Tool.add("engine")
def _server_kill(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_engine(cmd_id)


@Tool.add("后台切赛季")
def _backend_switch_season(free_type):
    if free_type:
        cmd_id = input("请输入服务器id：")
    else:
        cmd_id = 2002
    server_backend(cmd_id)


@Tool.add("退出")
def sys_exit(free_type):
    sys.exit()


if __name__ == '__main__':
    Tool.run()
